import request from '@/plugins/request'
export function getUsersList (params) {
  return request({
    url: '/users',
    method: 'get',
    params
  })
}
export function userStateUpdata (userinfo) {
  return request({
    url: `users/${userinfo.id}/state/${userinfo.mg_state}`,
    method: 'put'
  })
}
export function createUser (data) {
  return request({
    url: 'users',
    method: 'post',
    data
  })
}
export function editUser (userinfo) {
  return request({
    url: `users/${userinfo.id}`,
    method: 'put',
    data: {
      email: userinfo.email,
      mobile: userinfo.mobile
    }
  })
}
export function delUser (id) {
  return request({
    url: `users/${id}`,
    method: 'delete'
  })
}
export function saveUserRole (params) {
  return request({
    url: `/users/${params.userId}/role`,
    method: 'put',
    data: { rid: params.roleId }
  })
}
